package com.wlj.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;

@RestController
public class FileController {

    @Autowired
    private FileService fileService;

    /**
     * 根据传入的文件，识别标准的两列生成mysql建表语句
     * @param files
     * @param tableName
     * @param tableComment
     * @return
     * @throws IOException
     */
    @PostMapping(value = "fileImport")
    public String batchImportUserKnowledge(@RequestParam(value="files") MultipartFile files,String tableName,String tableComment) throws IOException {


        //批量导入
        //哈哈哈哈
        //44444
        String message = fileService.fileImport(tableName,tableComment,files);
        return message;
    }
}
